//
//  AccountSetupDelegate.m
//
//  Created by Alexander Chaika on 24.01.12.
//  Copyright 2012 __MyCompanyName__. All rights reserved.
//

#import "resource.h"

#import "AccountSetupDelegate.h"

@implementation AccountSetupDelegate

- (IBAction)onOK:(id)sender {
	// store value in defaults
	[[NSUserDefaults standardUserDefaults] setObject:[authCodeField stringValue]
											  forKey:kAuthorizationCode];
	// clear refresh token value
	[[NSUserDefaults standardUserDefaults] setObject:nil
											  forKey:kRefreshToken];
	[accountSheet orderOut:nil];
	[NSApp endSheet:accountSheet returnCode:NSOKButton];
}

- (IBAction)onCancel:(id)sender {
	[accountSheet orderOut:nil];
	[NSApp endSheet:accountSheet returnCode:NSCancelButton];
}

@end
